home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / DISKUTIL / MBOOT / !MakeBoot / Source (.txt) < prev   
RISC OS BBC BASIC V Source  |  1993-05-15  |  25KB  |  1,104 lines

  1.  ><MakeBoot$Dir>.Source
  2.  This application is FreeWare. (c) 1993 Dick Alstein
  3. error
  4. quit%=
  5. )mask%=1+(1<<4)+(1<<5)+(1<<11)+(1<<12)
  6.  "Wimp_Poll",mask%,blk% 
  7.  reason%
  8.  reason% 
  9.  2 : 
  10.  "Wimp_OpenWindow",,blk%
  11.  blk%!0 
  12. !      
  13.  winhdl%(0),winhdl%(1)
  14. .        
  15.  "Wimp_GetPointerInfo",,ptrinfo%
  16.         
  17.  ptrinfo%!8=1 
  18. )          
  19.  "Filer_OpenDir "+bootdir$
  20.         
  21.         
  22.  -1) 
  23. )          
  24.  "Wimp_CloseWindow",,blk%
  25.         
  26.       
  27. '        
  28.  "Wimp_CloseWindow",,blk%
  29.         
  30.  6 : 
  31. mouseclick(blk%!0,blk%!4,blk%!8,blk%!12,blk%!16)
  32.  7 : 
  33. moveappl
  34.  8 : 
  35. key(blk%!0,blk%!4,blk%!24)
  36.  9 : 
  37. menuselect(blk%)
  38.  17,18 : 
  39. receive(blk%!4,blk%!8,blk%!16)
  40.  quit%
  41.  "Wimp_CloseDown"
  42.  buf%,w%,i%
  43. Appl$="MakeBoot"
  44. Version$="1.11 (15-05-93)"
  45.  errblk% &100
  46.  "Wimp_Initialise",200,&4B534154,Appl$ 
  47.  osversion%,thistask%
  48. error : 
  49.  blk% &600
  50. indsize%=&600
  51.  indir% indsize%
  52. indirend%=indir%+indsize%
  53.  ptrinfo% 20
  54.  dragblk% 60
  55.  scrapblk% 256
  56.  "OS_ReadVarVal","MakeBoot$Dir",scrapblk%,256,0 
  57.  ,,len%
  58. scrapblk%?len%=13
  59. ApplDir$=$(scrapblk%)
  60. ApplPath$="MakeBootRes:"
  61. scrapblk%!0=-1
  62. 6!scrapblk%!4=0 : scrapblk%!8=0
  63. 7%scrapblk%!12=82 : scrapblk%!16=68
  64. scrapblk%!20=&7000301A
  65. $(scrapblk%+24)="!makeboot"
  66.  "Wimp_CreateIcon",,scrapblk% 
  67.  baricon%
  68.  winhdl%(1)
  69.  wintitle%(1)
  70. maxapps%=64
  71.  "Wimp_OpenTemplate",,ApplPath$+"Templates"
  72. ?"infowin%=
  73. loadtemplate("Info")
  74. @!$(blk%!(92+3*32+20))=Version$
  75. A'winhdl%(0)=
  76. loadtemplate("BootSeq")
  77. wintitle%(0)=blk%!76
  78. icon0xmin%=blk%!(92+0*32+0)
  79. icon0xmax%=blk%!(92+0*32+8)
  80. icon0ymin%=blk%!(92+0*32+4)
  81. icon1xmin%=blk%!(92+1*32+0)
  82. icon1xmax%=blk%!(92+1*32+8)
  83. H+winhdl%(1)=
  84. loadtemplate("DeskBootSeq")
  85. wintitle%(1)=blk%!76
  86. J#filewin%=
  87. loadtemplate("Files")
  88.  fname%(1)
  89. fname%(0)=blk%!(92+2*32+20)
  90. fname%(1)=blk%!(92+3*32+20)
  91. N(dialogwin%=
  92. loadtemplate("Dialogue")
  93. dial_msg%=blk%!(92+20)
  94. P<dial_buttoncol%=(blk%!(92+1*32+16)) 
  95.  ((1<<2)+(&FF<<24))
  96.  "Wimp_CloseTemplate"
  97. msg_init
  98. nractions%=5
  99.  action$(nractions%+1)
  100. action$(0)="Run"
  101. action$(1)="Boot"
  102. action$(2)="IconSprites"
  103. action$(3)="Filer_OpenDir"
  104. action$(4)="ToolSprites"
  105. action$(5)="Filer_Boot"
  106.  Action$(nractions%+1)
  107.  i%=0 
  108.  nractions%
  109. ]&  Action$(i%)=
  110. upcase(action$(i%))
  111.  nrapps%(1)
  112. nrapps%(0)=-1
  113. nrapps%(1)=-1
  114.  applname$(1,maxapps%)
  115.  appltype%(1,maxapps%)
  116.  applsprite%(1,maxapps%)
  117.  appltext%(1,maxapps%)
  118.  applaction%(1,maxapps%)
  119.  applactiontxt%(1,maxapps%)
  120.  applargs%(1,maxapps%)
  121.  w%=0 
  122.  i%=0 
  123.  maxapps%
  124.  buf% 16
  125.     appltext%(w%,i%)=buf%
  126.  buf% 12
  127.     applsprite%(w%,i%)=buf%
  128.  buf% 16
  129. p"    applactiontxt%(w%,i%)=buf%
  130.  buf% 64
  131.     $(buf%)=""
  132.     applargs%(w%,i%)=buf%
  133. initmenus
  134. readscreenvars
  135.  changed%(1)
  136. changed%(0)=
  137. changed%(1)=
  138. {*bootdir$=
  139. striproot(ApplDir$)+".!Boot"
  140.  seqfname$(1)
  141. seqfname$(0)="!Run"
  142. seqfname$(1)="DeskBoot"
  143. loadall
  144. addappl(w%,name$,type%,action%,args$,nr%)
  145.  nrapps%(w%)=maxapps% 
  146. dialogue(0)
  147. addicons(w%)
  148.  (nr%<=nrapps%(w%)) 
  149.  (nrapps%(w%)>=0) 
  150. #    
  151.  I%=nrapps%(w%) 
  152.  nr% 
  153. -      applname$(w%,I%+1)=applname$(w%,I%)
  154. -      appltype%(w%,I%+1)=appltype%(w%,I%)
  155. 1      applaction%(w%,I%+1)=applaction%(w%,I%)
  156. -      applargs%(w%,I%+1)=applargs%(w%,I%)
  157.       
  158. updateline(w%,I%+1)
  159.   applname$(w%,nr%)=name$
  160.   appltype%(w%,nr%)=type%
  161.  action%=-1 
  162. +    
  163.  attach default action to new item
  164.  type% 
  165. )      
  166.  &1000 : applaction%(w%,nr%)=3
  167.       
  168.  &2000
  169. +        
  170. fileexists(name$+".!Boot") 
  171. #          applaction%(w%,nr%)=1
  172.         
  173. 0          
  174. fileexists(name$+".!Sprites") 
  175. %            applaction%(w%,nr%)=1
  176.           
  177. %            applaction%(w%,nr%)=0
  178.           
  179.         
  180. )      
  181.  &FF9  : applaction%(w%,nr%)=2
  182. $      
  183.   : applaction%(w%,nr%)=0
  184.         
  185. #    applaction%(w%,nr%)=action%
  186.    $(applargs%(w%,nr%))=args$
  187. updateline(w%,nr%)
  188.   nrapps%(w%)+=1
  189. setchanged(w%,
  190. addicons(w%)
  191.  linenr%,at%,as%,aa%
  192. linenr%=nrapps%(w%)+1
  193. scrapblk%!0=winhdl%(w%)
  194. scrapblk%!4=icon0xmin%+12
  195. scrapblk%!12=icon0xmax%
  196. (scrapblk%!16=icon0ymin%-(80*linenr%)
  197. !scrapblk%!8=(scrapblk%!16)-80
  198. scrapblk%!20=&17006133
  199. at%=appltext%(w%,linenr%)
  200. $(at%)=""
  201. scrapblk%!24=at%
  202. as%=applsprite%(w%,linenr%)
  203. $(as%)="S"
  204. scrapblk%!28=as%
  205. scrapblk%!32=16
  206.  "Wimp_CreateIcon",,scrapblk%
  207. "aa%=applactiontxt%(w%,linenr%)
  208. scrapblk%!4=icon1xmin%
  209. scrapblk%!12=icon1xmax%
  210. scrapblk%!20=&1B003131
  211. $(aa%)=""
  212. scrapblk%!24=aa%
  213. scrapblk%!28=-1
  214. scrapblk%!32=16
  215.  "Wimp_CreateIcon",,scrapblk%
  216. setextent(w%,linenr%)
  217. clearsequence(w%)
  218.  nrapps%(w%)>=0
  219. deleteicons(w%)
  220.   nrapps%(w%)-=1
  221. deleteappl(w%,nr%)
  222.  I%=nr% 
  223.  (nrapps%(w%)-1)
  224. )  applname$(w%,I%)=applname$(w%,I%+1)
  225. )  appltype%(w%,I%)=appltype%(w%,I%+1)
  226. -  applaction%(w%,I%)=applaction%(w%,I%+1)
  227. )  applargs%(w%,I%)=applargs%(w%,I%+1)
  228. updateline(w%,I%)
  229. deleteicons(w%)
  230. nrapps%(w%)-=1
  231. setchanged(w%,
  232. deleteicons(w%)
  233.  linenr%
  234. linenr%=nrapps%(w%)
  235. applname$(w%,linenr%)=""
  236. updateline(w%,linenr%)
  237. scrapblk%!0=winhdl%(w%)
  238. scrapblk%!4=2*linenr%+2
  239.  "Wimp_DeleteIcon",,scrapblk%
  240. scrapblk%!4=2*linenr%+3
  241.  "Wimp_DeleteIcon",,scrapblk%
  242. setextent(w%,linenr%-1)
  243. dirname(F$)
  244.  p%,q%
  245. F$,".",p%)
  246.  q% > 0 
  247.  p%=q%+1
  248.  q%=0
  249. F$,p%-2)
  250. errbox(err$,boxes%)
  251. errblk%!0=0
  252. $(errblk%+4)=err$+
  253.  "Wimp_ReportError",errblk%,boxes%,Appl$ 
  254.  ,click%
  255. =(click%=1)
  256. error
  257.  "Wimp_CloseDown" : 
  258. errbox(
  259. $+" (line "+
  260. )+")",3) 
  261.  "Wimp_CloseDown"
  262. direxists(f$)
  263.  type%,flags%
  264. type%=0
  265. (f$)>0 
  266.  "XOS_File",17,f$ 
  267.  type%;flags%
  268. =(type%=2)
  269. ((flags% 
  270.  1)=0)
  271. fileexists(f$)
  272.  type%,flags%
  273. type%=0
  274. (f$)>0 
  275.  "XOS_File",17,f$ 
  276.  type%;flags%
  277. =(type%=1)
  278. ((flags% 
  279.  1)=0)
  280. seqfname(i%)
  281. =bootdir$+"."+seqfname$(i%)
  282. key(window%,icon%,key%)
  283.  window% 
  284.  filewin%
  285. !    
  286.  (icon%=3) 
  287.  (key%=13) 
  288.       bootdir$=$(fname%(0))
  289. #      seqfname$(1)=$(fname%(1))
  290. #      
  291. selecticon(filewin%,4,1)
  292. "      
  293.  "Wimp_CreateMenu",,-1
  294. #      
  295. selecticon(filewin%,4,0)
  296.          
  297. !#      
  298.  "Wimp_ProcessKey",key%
  299. "        
  300. $!    
  301.  "Wimp_ProcessKey",key%
  302. leafname(f$)
  303.  p%,q%
  304.   p%=q%+1
  305.   q%=
  306. f$,".",p%)
  307.  q%=0
  308. f$,p%)
  309.  --- split name of root directory from pathname ---
  310. striproot(f$)
  311.  p%,q%
  312. f$,"$")
  313.  q%>0
  314.   p%=q%
  315.   q%=
  316. f$,"$",p%+1)
  317. f$,p%)
  318. loadall
  319.  i%,loaderror%
  320. loaderror%=0
  321.  "Hourglass_On"
  322. direxists(bootdir$) 
  323.  i%=0 
  324. B&    
  325. fileexists(
  326. seqfname(i%)) 
  327.       
  328. loadsequence(i%)
  329. D        
  330. E*      
  331.  loaderror%=0 
  332.  loaderror%=1+i%
  333. F        
  334.   loaderror%=4
  335.  "Hourglass_Off"
  336.  loaderror% 
  337.  1 : 
  338. dialogue(1)
  339.  2 : 
  340. dialogue(2)
  341.  3 : 
  342. dialogue(3)
  343.  4 : 
  344. dialogue(4)
  345. loadsequence(w%)
  346.  p%,in$,cmd$,file$,arg$,act%,tagfound%
  347. tagfound%=
  348. seqfname(w%))
  349.  F%<>0 
  350.  #F% : 
  351. error : 
  352.   in$=
  353.   p%=
  354. in$,"|")
  355.  p%>0 
  356.  tagfound% 
  357. _'      tagfound%=(
  358. in$,Appl$,p%)<>0)
  359. `        
  360.     in$=
  361. in$,p%-1)
  362.   p%=
  363. in$," ")
  364. d)  cmd$=
  365. upcase(
  366. trimleft(
  367. in$,p%-1)))
  368.   in$=
  369. trimleft(
  370. in$,p%+1))
  371.   p%=
  372. in$," ")
  373.   file$=
  374. in$,p%-1)
  375. h   arg$=
  376. trimleft(
  377. in$,p%+1))
  378. cmd$,1)="*"
  379. j9    cmd$=
  380. cmd$,2) : 
  381.  strip leading "*"s from command
  382. cmd$,1)="%" 
  383. m8    cmd$=
  384. cmd$,2) : 
  385.  strip leading "%" from command
  386.  (cmd$<>"") 
  387.  (file$<>"") 
  388.     act%=0
  389. q5    
  390.  (act%<=nractions%) 
  391.  (cmd$<>Action$(act%))
  392.       act%+=1
  393. s        
  394.  (act%<=nractions%) 
  395.       
  396.  act% 
  397.         
  398. w3          
  399. upcase(
  400. leafname(file$))="!BOOT" 
  401.             act%=1
  402. y%            file$=
  403. dirname(file$)
  404.           
  405.         
  406. |:          
  407. upcase(
  408. leafname(file$)),8)="!SPRITES" 
  409. }6            
  410. leafname(
  411. dirname(file$)),1)="!" 
  412.               act%=1
  413. '              file$=
  414. dirname(file$)
  415.             
  416.           
  417.       
  418. D      
  419. addappl(w%,file$,
  420. objtype(file$),act%,arg$,nrapps%(w%)+1)
  421.         
  422. 9      
  423.  (cmd$="DESKTOP") 
  424.  (file$="-File") 
  425.  (w%=0) 
  426. (        seqfname$(1)=
  427. leafname(arg$)
  428.       
  429.         
  430.  tagfound%) 
  431.  (loaderror%=0) 
  432.   loaderror%=3
  433. setchanged(w%,
  434. loadtemplate(name$)
  435.  handle%
  436.  "Wimp_CloseTemplate" : 
  437. error
  438.  "Wimp_LoadTemplate",,blk%+4,indir%,indirend%,-1,name$,0 
  439.  ,,indir%
  440.  "Wimp_CreateWindow",,blk%+4 
  441.  handle%
  442. =handle%
  443. mouseclick(xpos%,ypos%,button%,wndw%,icon%)
  444.  wndw% 
  445.  (button% 
  446. "      
  447. closewindow(winhdl%(0))
  448. "      
  449. closewindow(winhdl%(1))
  450.         
  451.  (button% 
  452. !      
  453. openwindow(winhdl%(0))
  454. !      
  455. openwindow(winhdl%(1))
  456.         
  457.  (button% 
  458. )      
  459. showmenu(blk%,mainmenu%,-1,-1)
  460.         
  461.  winhdl%(0),winhdl%(1)
  462.  wndw%=winhdl%(0) 
  463.       w%=0
  464.         
  465.       w%=1
  466.         
  467.     linenr%=(icon%-2) 
  468. 8    
  469.  (button% 
  470.  ((icon% 
  471.  2)=1) 
  472.  (icon%>=2) 
  473.       
  474.  (button%=1)
  475.         
  476. +          
  477.  applaction%(w%,linenr%)=0 
  478. 2            applaction%(w%,linenr%)=nractions%
  479.           
  480. *            applaction%(w%,linenr%)-=1
  481.           
  482. L        
  483. validaction(applaction%(w%,linenr%),w%,appltype%(w%,linenr%))
  484.       
  485.         
  486. 4          
  487.  applaction%(w%,linenr%)=nractions% 
  488. )            applaction%(w%,linenr%)=0
  489.           
  490. *            applaction%(w%,linenr%)+=1
  491.           
  492. L        
  493. validaction(applaction%(w%,linenr%),w%,appltype%(w%,linenr%))
  494.       
  495. !      
  496. updateline(w%,linenr%)
  497.       
  498. setchanged(w%,
  499.         
  500.  (button% 
  501.       
  502.  icon%>=2 
  503. /        
  504. showmenu(blk%,seqmenu%,w%,linenr%)
  505.       
  506. *        
  507. showmenu(blk%,seqmenu%,w%,-1)
  508.       
  509.         
  510. 3    
  511.  (button% 
  512.  16) 
  513.  (linenr%<=nrapps%(w%)) 
  514.        
  515. startdrag(w%,linenr%)
  516.         
  517.  filewin%
  518.  icon% 
  519.       
  520. !        bootdir$=$(fname%(0))
  521. %        seqfname$(1)=$(fname%(1))
  522. $        
  523.  "Wimp_CreateMenu",,-1
  524.         
  525.  dialogwin%
  526.  lastdialogue% 
  527.       
  528.         
  529.  icon%=1 
  530.  quit%=
  531.         
  532.      
  533.  "Wimp_CreateMenu",,-1
  534. openwindow(handle%)
  535. scrapblk%!0=handle%
  536.  "Wimp_GetWindowState",,scrapblk%
  537. scrapblk%!28=-1
  538.  "Wimp_OpenWindow",,scrapblk%
  539. closewindow(handle%)
  540. scrapblk%!0=handle%
  541.  "Wimp_CloseWindow",,scrapblk%
  542. moveappl
  543.  w%,linenr%,an$,at%,aa%,ar$,ar%
  544.  "Wimp_GetPointerInfo",,ptrinfo%
  545.     w%=-1
  546.  ptrinfo%!12=winhdl%(0) 
  547.  w%=0
  548.  ptrinfo%!12=winhdl%(1) 
  549.  w%=1
  550.  w%<>-1 
  551.  ptrinfo%!16 
  552.       
  553.  w%=dragfromwin% 
  554.         linenr%=nrapps%(w%)
  555.       
  556. !        linenr%=nrapps%(w%)+1
  557.       
  558.       linenr%=0
  559.         
  560. &      linenr%=(ptrinfo%!16 - 2)
  561. /  an$=applname$(dragfromwin%,dragfromline%)
  562. /  at%=appltype%(dragfromwin%,dragfromline%)
  563. 1  aa%=applaction%(dragfromwin%,dragfromline%)
  564. /  ar%=applargs%(dragfromwin%,dragfromline%)
  565. 2  ar$=$(applargs%(dragfromwin%,dragfromline%))
  566.  w%=dragfromwin% 
  567. !    
  568.  dragfromline%>linenr% 
  569.       
  570.  move down
  571. /      
  572.  I%=(dragfromline%-1) 
  573.  linenr% 
  574. /        applname$(w%,I%+1)=applname$(w%,I%)
  575. /        appltype%(w%,I%+1)=appltype%(w%,I%)
  576.     3        applaction%(w%,I%+1)=applaction%(w%,I%)
  577. /        applargs%(w%,I%+1)=applargs%(w%,I%)
  578.          
  579. updateline(w%,I%+1)
  580.       
  581.         
  582. !    
  583.  dragfromline%<linenr% 
  584.       
  585.  move up
  586. *      
  587.  I%=dragfromline% 
  588.  (linenr%-1)
  589. /        applname$(w%,I%)=applname$(w%,I%+1)
  590. /        appltype%(w%,I%)=appltype%(w%,I%+1)
  591. 3        applaction%(w%,I%)=applaction%(w%,I%+1)
  592. /        applargs%(w%,I%)=applargs%(w%,I%+1)
  593.         
  594. updateline(w%,I%)
  595.       
  596.         
  597. !    applname$(w%,linenr%)=an$
  598. !    appltype%(w%,linenr%)=at%
  599. #    applaction%(w%,linenr%)=aa%
  600. !    applargs%(w%,linenr%)=ar%
  601. updateline(w%,linenr%)
  602. $    
  603.  (dragfromline%<>linenr%) 
  604.       
  605. setchanged(w%,
  606.         
  607.  move to other window
  608. "     
  609.  nrapps%(w%)<maxapps% 
  610. #.      
  611. addappl(w%,an$,at%,aa%,ar$,linenr%)
  612. $1      
  613. deleteappl(dragfromwin%,dragfromline%)
  614. %        
  615. readscreenvars
  616.  xeig%,yeig%,xpixels%,ypixels%
  617.  "OS_ReadModeVariable",-1,4 
  618.  ,,xeig%
  619.  "OS_ReadModeVariable",-1,5 
  620.  ,,yeig%
  621.  "OS_ReadModeVariable",-1,11 
  622.  ,,xpixels%
  623.  "OS_ReadModeVariable",-1,12 
  624.  ,,ypixels%
  625. 0Escreensize_x%=(xpixels%+1)*(1<<xeig%) : 
  626.  screen size in OS units
  627. 1)screensize_y%=(ypixels%+1)*(1<<yeig%)
  628. receive(sender%,ref%,code%)
  629.  w%,ack%,file$,type%
  630. ack%=
  631.  sender% <> thistask% 
  632.  code% 
  633.       quit%=
  634.       ack%=
  635.       file$=
  636. str(blk%+44)
  637.       type%=blk%!40
  638.       
  639.  blk%!20 
  640. @#        
  641.  winhdl%(0),winhdl%(1)
  642. A&          
  643.  (blk%!20=winhdl%(0)) 
  644.             w%=0
  645.           
  646.             w%=1
  647.           
  648.           
  649.  (blk%!24=-1) 
  650. G%            linenr%=nrapps%(w%)+1
  651.           
  652. I'            linenr%=(blk%!24 - 2)
  653. J'            
  654.  linenr%<0 
  655.  linenr%=0
  656.           
  657. L4          
  658. addappl(w%,file$,type%,-1,"",linenr%)
  659.           ack%=
  660.         
  661. O2          
  662.  (blk%!24=baricon%) 
  663.  (type%=&2000)
  664. P0            
  665. upcase(
  666. file$,7))="$.!BOOT" 
  667. Q               bootdir$=file$
  668. R#              
  669. clearsequence(0)
  670. S#              
  671. clearsequence(1)
  672.               
  673. loadall
  674.             
  675.           
  676.       
  677.  &400C0
  678.       $(fname%(0))=bootdir$
  679. Z#      $(fname%(1))=seqfname$(1)
  680. [:      
  681.  "Wimp_CreateSubMenu",,blk%!20,blk%!24,blk%!28
  682.  &400C1
  683.       
  684. readscreenvars
  685.  ack% 
  686.     blk%!0=20
  687.     blk%!12=ref%
  688.     blk%!16=4
  689. c-    
  690.  "Wimp_SendMessage",17,blk%,sender%
  691. saveall
  692. savesequence(0)
  693. savesequence(1)
  694. savesequence(w%)
  695.  (nrapps%(w%)<0) 
  696.  (w%=1) 
  697. dialogue(5)
  698.   F%=0
  699.   F%=
  700. seqfname(w%))
  701.  F%<>0 
  702.  #F% : 
  703. error : 
  704. #F%,"|"
  705. #F%,"| This file was automatically generated by "+Appl$+" v"+Version$
  706. #F%,"| Do not edit with another program; changes may make it unreadable"
  707. #F%,"|"
  708.  I%=0 
  709.  nrapps%(w%)
  710. z"    
  711.  appltype%(w%,I%)=&2000 
  712. {!      
  713.  applaction%(w%,I%) 
  714.         
  715. }8          
  716. fileexists(applname$(w%,I%)+".!Boot") 
  717. ~6            
  718. #F%,"Run "+applname$(w%,I%)+".!Boot";
  719.           
  720. A            
  721. #F%,"IconSprites "+applname$(w%,I%)+".!Sprites";
  722.           
  723.         
  724. D          
  725. #F%,action$(applaction%(w%,I%))+" "+applname$(w%,I%);
  726.       
  727.         
  728. @      
  729. #F%,action$(applaction%(w%,I%))+" "+applname$(w%,I%);
  730.         
  731. $    
  732. #F%," "+$(applargs%(w%,I%))
  733.  w%=0 
  734. ,    
  735. #F%,"%Desktop -File "+
  736. seqfname(1);
  737.  "OS_File",18,
  738. seqfname(w%),&FEB
  739. setchanged(w%,
  740. setchanged(w%,newval%)
  741.  changed%(w%) 
  742.  newval% 
  743.   t$=$(wintitle%(w%))
  744.  changed%(w%) 
  745. %    $(wintitle%(w%))=
  746. (t$)-2)
  747.      $(wintitle%(w%))=t$+" *"
  748. !  changed%(w%)=
  749.  changed%(w%)
  750.   blk%!0=winhdl%(w%)
  751.  "Wimp_GetWindowState",,blk%
  752.  (blk%!32 
  753.  (1<<16)) 
  754. H    
  755.  "Wimp_ForceRedraw",-1,blk%!4,(blk%!16)+4,blk%!12,(blk%!16)+36
  756. setextent(w%,lastline%)
  757.  lastline%<2 
  758.  lastline%=2
  759. scrapblk%!0=0
  760. -scrapblk%!4=icon0ymin%-80*(lastline%+2)-8
  761. scrapblk%!8=icon0xmax%
  762. scrapblk%!12=0
  763.  "Wimp_SetExtent",winhdl%(w%),scrapblk%
  764. scrapblk%!0=winhdl%(w%)
  765.  "Wimp_GetWindowState",,scrapblk%
  766.  (scrapblk%!32 
  767.  (1<<16)) 
  768.  "Wimp_OpenWindow",,scrapblk%
  769. sprexists(sp$)
  770.  flags%
  771.  "XWimp_SpriteOp",&18,,sp$ 
  772.  ;flags%
  773. =((flags% 
  774.  1)=0)
  775. startdrag(w%,linenr%)
  776. blk%!0=winhdl%(w%)
  777.  "Wimp_GetWindowState",,blk%
  778. dragblk%!4=5
  779. dragblk%!8=(blk%!4)+4
  780. Adragblk%!12=(blk%!16)+icon0ymin%-((linenr%+1)*80)-(blk%!24)-4
  781. 7dragblk%!16=(dragblk%!8)+(icon1xmax%-icon0xmin%-16)
  782.  dragblk%!20=(dragblk%!12)+88
  783. dragblk%!24=0
  784. dragblk%!28=0
  785. dragblk%!32=xpixels%
  786. dragblk%!36=ypixels%
  787.  "Wimp_DragBox",,dragblk%
  788. dragfromwin%=w%
  789. dragfromline%=linenr%
  790. str(s%)
  791.  i%,n$
  792.  s%?i% >= 32 : n$+=
  793. (s%?i%) : i%+=1 : 
  794. trimleft(s$)
  795. s$,p%,1)=" "
  796.   p%+=1
  797. s$,p%)
  798. trimright(s$)
  799. s$,p%,1)=" ")
  800.   p%-=1
  801. s$,1,p%)
  802. upcase(s$)
  803.  i%=1 
  804.   a%=
  805. s$,i%,1))
  806.  (a%>=97)
  807. (a%<=122) 
  808. s$,i%,1)=
  809. (a%-32)
  810. updateicon(window%,icon%)
  811. scrapblk%!0=window%
  812. scrapblk%!4=icon%
  813. scrapblk%!8=0
  814. scrapblk%!12=0
  815.  "Wimp_SetIconState",,scrapblk%
  816. updateline(w%,linenr%)
  817.  leafn$,spr$
  818. +leafn$=
  819. leafname(applname$(w%,linenr%))
  820. '$(appltext%(w%,linenr%))=" "+leafn$
  821. spr$=""
  822.  leafn$<>"" 
  823.  appltype%(w%,linenr%) 
  824. "    
  825.  &1000 : spr$="directory"
  826.  &2000
  827.        
  828. sprexists(leafn$) 
  829.         spr$=leafn$
  830.       
  831.         spr$="application"
  832.       
  833.  &FFFFFFFF
  834.       spr$="file_xxx"
  835.         
  836. 0      spr$="file_"+
  837. ~(appltype%(w%,linenr%))
  838.        
  839. sprexists(spr$) 
  840.         spr$="file_xxx"
  841.       
  842. '$(applsprite%(w%,linenr%))="S"+spr$
  843. updateicon(winhdl%(w%),2*linenr%+2)
  844.  leafn$="" 
  845.     &  $(applactiontxt%(w%,linenr%))=""
  846. D  $(applactiontxt%(w%,linenr%))=action$(applaction%(w%,linenr%))
  847. updateicon(winhdl%(w%),2*linenr%+3)
  848. objtype(name$)
  849.  type%,loadaddr%
  850.  "OS_File",17,name$ 
  851.  type%,,loadaddr%
  852.  type% 
  853. (    
  854.  ((loadaddr%>>20)
  855.  &FFF)=&FFF 
  856. %      type%=(loadaddr%>>8) 
  857.  &FFF
  858.         
  859.       type%=-1
  860.         
  861. $    
  862. leafname(file$),1)="!" 
  863.       type%=&2000
  864.         
  865.       type%=&1000
  866.         
  867. =type%
  868. validaction(action%,window%,type%)
  869.  valid%
  870.  type% 
  871.  &FF9
  872.     valid%=(action%=2)
  873. (7    
  874.  osversion%>=300 
  875.  valid%=valid% 
  876.  (action%=4)
  877.  &1000
  878.     valid%=(action%=3)
  879.  &2000
  880.  action% 
  881.       
  882.  0,1,3 : valid%=
  883. .:      
  884.  5     : valid%=(osversion%>=300) 
  885.  (window%=1)
  886.       
  887.   : valid%=
  888. 0        
  889.     valid%=(action%=0)
  890. =valid%
  891. seticonstate(window%,icon%,eor%,clr%)
  892. scrapblk%!0=window%
  893. scrapblk%!4=icon%
  894. scrapblk%!8=eor%
  895. scrapblk%!12=clr%
  896.  "Wimp_SetIconState",,scrapblk%
  897. selecticon(window%,icon%,f%)
  898. scrapblk%!0=window%
  899. scrapblk%!4=icon%
  900.   scrapblk%!8=1<<21
  901.   scrapblk%!8=0
  902. scrapblk%!12=1<<21
  903.  "Wimp_SetIconState",,scrapblk%
  904. menuselect(selection%)
  905.  adjust%,selinfo%,itemnr%,item%,item$,parentitem%,seq%
  906.  "MenuUtil_Decode",lastmenu%,selection% 
  907.  ,adjust%,selinfo%
  908. itemnr%=selinfo%!0
  909. item%=selinfo%!8
  910. item$=
  911. str(selinfo%!12)
  912. parentitem%=selinfo%!24
  913. seq%=lastmenu_seq%
  914.  item% 
  915.  item_reread%
  916. clearsequence(0)
  917. clearsequence(1)
  918. loadall
  919.  item_saveall%
  920. saveall
  921.  item_quit%
  922. Z%    
  923.  changed%(0) 
  924.  changed%(1) 
  925.       
  926. dialogue(6)
  927. \        
  928.       quit%=
  929. ^        
  930.  item_openparent%
  931. `C    
  932.  "Filer_OpenDir "+
  933. dirname(applname$(seq%,lastmenu_line%))
  934.  item_delete%
  935. b(    
  936. deleteappl(seq%,lastmenu_line%)
  937.     lastmenu_line%=-1
  938.  item_args%
  939. e/    $(applargs%(seq%,lastmenu_line%))=item$
  940. setchanged(seq%,
  941.  item_toroot%
  942. hQ    applname$(seq%,lastmenu_line%)=
  943. striproot(applname$(seq%,lastmenu_line%))
  944. i(    
  945. updateline(seq%,lastmenu_line%)
  946.  item_saveseq%
  947. savesequence(seq%)
  948.  adjust% 
  949. showmenu(0,lastmenu%,lastmenu_seq%,lastmenu_line%)
  950.  *** procs for creating menus ***
  951. showmenu(blkptr%,menu%,seq%,linenr%)
  952.  item$
  953.  blkptr%<>0 
  954.   blkptr%!4=blkptr%!4+22
  955.   lastmenu%=menu%
  956.   lastmenu_seq%=seq%
  957.   lastmenu_line%=linenr%
  958.  menu%=seqmenu% 
  959. }(  item$=
  960. msg_lookup0("IT_ITEM")+" '"
  961.  linenr%>=0 
  962. 1    item$+=
  963. leafname(applname$(seq%,linenr%))
  964. @    
  965.  "MenuUtil_Text",item_args%,$(applargs%(seq%,linenr%))
  966. H    
  967.  "MenuUtil_Fade",item_toroot%,(appltype%(seq%,linenr%)<>&1000)
  968. I    
  969.  "MenuUtil_Tick",item_argsmenu%,
  970. ($(applargs%(seq%,linenr%)))>0
  971.   item$+="'"
  972.  "MenuUtil_Text",item_item%,item$
  973.  "MenuUtil_Fade",item_item%,linenr%<0
  974.  "MenuUtil_Show",lastmenu%,blkptr%
  975. menu_add(text$,submenu%,genmsg%)
  976.  handle%
  977.  "MenuUtil_Add",,text$ 
  978.  handle%
  979.  submenu%<>-1 
  980.  "MenuUtil_SubMenu",handle%,submenu%
  981.  genmsg% 
  982.  "MenuUtil_Warning",handle%,1
  983. =handle%
  984. menu_addwritable(maxlen%,validstr%)
  985.  handle%
  986.  "MenuUtil_Add",,"" 
  987.  handle%
  988.  "MenuUtil_Writable",,1,maxlen%,validstr%
  989. =handle%
  990. initmenus
  991.  "MenuUtil_Initialise",010,0
  992.  "MenuUtil_New",,Appl$ 
  993.  mainmenu%
  994. <item_info%=
  995. menu_add(
  996. msg_lookup0("IT_INFO"),infowin%,0)
  997. 8item_reread%=
  998. menu_add(
  999. msg_lookup0("IT_RERD"),-1,0)
  1000. >item_fnames%=
  1001. menu_add(
  1002. msg_lookup0("IT_FNMS"),filewin%,1)
  1003. 9item_saveall%=
  1004. menu_add(
  1005. msg_lookup0("IT_SVAL"),-1,0)
  1006.  "MenuUtil_Dots",0,1
  1007. 6item_quit%=
  1008. menu_add(
  1009. msg_lookup0("IT_QUIT"),-1,0)
  1010.  "MenuUtil_New",,
  1011. msg_lookup0("IT_ARGS") 
  1012.  argsmenu%
  1013. &item_args%=
  1014. menu_addwritable(64,0)
  1015.  "MenuUtil_New",,
  1016. msg_lookup0("IT_ITEM") 
  1017.  itemsubmenu%
  1018. Aitem_argsmenu%=
  1019. menu_add(
  1020. msg_lookup0("IT_ARGS"),argsmenu%,0)
  1021. 7item_delete%=
  1022. menu_add(
  1023. msg_lookup0("IT_DEL"),-1,0)
  1024. <item_openparent%=
  1025. menu_add(
  1026. msg_lookup0("IT_OPAR"),-1,0)
  1027. 8item_toroot%=
  1028. menu_add(
  1029. msg_lookup0("IT_ROOT"),-1,0)
  1030.  "MenuUtil_New",,
  1031. msg_lookup0("IT_SEQ") 
  1032.  seqmenu%
  1033. +item_item%=
  1034. menu_add("",itemsubmenu%,0)
  1035. 9item_saveseq%=
  1036. menu_add(
  1037. msg_lookup0("IT_SVSQ"),-1,0)
  1038. lastmenu%=0
  1039.  *** procs for handling messages in the Messages file ***
  1040. msg_init
  1041.  fname$,flags%,size%,buf%
  1042. fname$=ApplPath$+"Messages"
  1043.  "MessageTrans_FileInfo",,fname$ 
  1044.  flags%,,size%
  1045.  flags% 
  1046.   buf%=0
  1047.  buf% size%
  1048.  MsgDesc% 17+
  1049. (fname$)
  1050. $(MsgDesc%+16)=fname$
  1051.  "MessageTrans_OpenFile",MsgDesc%,MsgDesc%+16,buf%
  1052. msg_exit
  1053.  "MessageTrans_CloseFile",MsgDesc%
  1054. MsgDesc%=0
  1055. msg_lookup0(token$)
  1056.  result%
  1057.  "MessageTrans_Lookup",MsgDesc%,token$,0 
  1058.  ,,result%
  1059. str(result%)
  1060. msg_lookup1(token$,param$)
  1061.  result%
  1062.  "MessageTrans_Lookup",MsgDesc%,token$,scrapblk%,&100,param$ 
  1063.  ,,result%
  1064. str(result%)
  1065. msg_lookup2(token$,param1$,param2$)
  1066.  result%
  1067.  "MessageTrans_Lookup",MsgDesc%,token$,scrapblk%,&100,param1$,param2$ 
  1068.  ,,result%
  1069. str(result%)
  1070. dialogue(no%)
  1071.  mask%,cancelbutton%
  1072. mask%=(1<<2)+(&FF<<24)
  1073. cancelbutton%=
  1074.  no% 
  1075. '    $dial_msg%=
  1076. msg_lookup0("NRMI")
  1077. 4    $dial_msg%=
  1078. msg_lookup1("CFBS",
  1079. seqfname(0))
  1080. 4    $dial_msg%=
  1081. msg_lookup1("CFBS",
  1082. seqfname(1))
  1083. -    $dial_msg%=
  1084. msg_lookup1("NTAG",Appl$)
  1085. 0    $dial_msg%=
  1086. msg_lookup1("CFBD",bootdir$)
  1087. '    $dial_msg%=
  1088. msg_lookup0("SEQ0")
  1089. '    $dial_msg%=
  1090. msg_lookup0("QNYW")
  1091.     cancelbutton%=
  1092.  cancelbutton% 
  1093. seticonstate(dialogwin%,1,dial_buttoncol%,mask%)
  1094. seticonstate(dialogwin%,2,&11<<24,mask%) : 
  1095.  make button invisible
  1096. seticonstate(dialogwin%,3,dial_buttoncol%,mask%)
  1097. seticonstate(dialogwin%,1,&11<<24,mask%)
  1098. seticonstate(dialogwin%,2,dial_buttoncol%,mask%)
  1099. seticonstate(dialogwin%,3,&11<<24,mask%)
  1100. scrapblk%!0=dialogwin%
  1101.  "Wimp_GetWindowState",,scrapblk%
  1102.  "Wimp_CreateMenu",,dialogwin%,scrapblk%!4,scrapblk%!16
  1103. lastdialogue%=no%
  1104.